#include "CorutineManager.h"


CorutineManager::CorutineManager(void)
	{
	}



void CorutineManager::addRutina( Corutina *rutina )
	{
		rutinas.push_back(rutina);
	}

void CorutineManager::update( float speedFactor )
	{
		if (rutinas.size()){
			Corutina *r = rutinas.front();

			if (r){
				if (!r->iniciado){
					r->iniciado = true;
					r->onStart();
				}
				if (r->terminado()){
					delete r;
					rutinas.pop_front();
					}else{
						r->update(speedFactor);
					}
				}
		}
	}

CorutineManager::~CorutineManager(void)
	{
	}
